home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIIOService.idl < prev    next >
Text File  |  2006-05-08  |  6KB  |  147 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  26.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #include "nsISupports.idl"
  39.  
  40. interface nsIProtocolHandler;
  41. interface nsIChannel;
  42. interface nsIURI;
  43. interface nsIFile;
  44.  
  45. /**
  46.  * nsIIOService provides a set of network utility functions.  This interface
  47.  * duplicates many of the nsIProtocolHandler methods in a protocol handler
  48.  * independent way (e.g., NewURI inspects the scheme in order to delegate
  49.  * creation of the new URI to the appropriate protocol handler).  nsIIOService
  50.  * also provides a set of URL parsing utility functions.  These are provided
  51.  * as a convenience to the programmer and in some cases to improve performance
  52.  * by eliminating intermediate data structures and interfaces.
  53.  *
  54.  * @status FROZEN
  55.  */
  56. [scriptable, uuid(bddeda3f-9020-4d12-8c70-984ee9f7935e)]
  57. interface nsIIOService : nsISupports
  58. {
  59.     /**
  60.      * Returns a protocol handler for a given URI scheme.
  61.      *
  62.      * @param aScheme the URI scheme
  63.      * @return reference to corresponding nsIProtocolHandler
  64.      */
  65.     nsIProtocolHandler getProtocolHandler(in string aScheme);
  66.  
  67.     /**
  68.      * Returns the protocol flags for a given scheme.
  69.      *
  70.      * @param aScheme the URI scheme
  71.      * @return value of corresponding nsIProtocolHandler::protocolFlags
  72.      */
  73.     unsigned long getProtocolFlags(in string aScheme);
  74.  
  75.     /**
  76.      * This method constructs a new URI by determining the scheme of the
  77.      * URI spec, and then delegating the construction of the URI to the
  78.      * protocol handler for that scheme. QueryInterface can be used on
  79.      * the resulting URI object to obtain a more specific type of URI.
  80.      *
  81.      * @see nsIProtocolHandler::newURI
  82.      */
  83.     nsIURI newURI(in AUTF8String aSpec,
  84.                   in string aOriginCharset,
  85.                   in nsIURI aBaseURI);
  86.  
  87.     /**
  88.      * This method constructs a new URI from a nsIFile.
  89.      *
  90.      * @param aFile specifies the file path
  91.      * @return reference to a new nsIURI object
  92.      */
  93.     nsIURI newFileURI(in nsIFile aFile);
  94.  
  95.     /**
  96.      * Creates a channel for a given URI.
  97.      *
  98.      * @param aURI nsIURI from which to make a channel
  99.      * @return reference to the new nsIChannel object
  100.      */
  101.     nsIChannel newChannelFromURI(in nsIURI aURI);
  102.  
  103.     /**
  104.      * Equivalent to newChannelFromURI(newURI(...))
  105.      */
  106.     nsIChannel newChannel(in AUTF8String aSpec,
  107.                           in string aOriginCharset,
  108.                           in nsIURI aBaseURI);
  109.  
  110.     /**
  111.      * Returns true if networking is in "offline" mode. When in offline mode, 
  112.      * attempts to access the network will fail (although this is not 
  113.      * necessarily corrolated with whether there is actually a network 
  114.      * available -- that's hard to detect without causing the dialer to 
  115.      * come up).
  116.      */
  117.     attribute boolean offline;
  118.  
  119.     /**
  120.      * Checks if a port number is banned. This involves consulting a list of
  121.      * unsafe ports, corresponding to network services that may be easily
  122.      * exploitable. If the given port is considered unsafe, then the protocol
  123.      * handler (corresponding to aScheme) will be asked whether it wishes to
  124.      * override the IO service's decision to block the port. This gives the
  125.      * protocol handler ultimate control over its own security policy while
  126.      * ensuring reasonable, default protection.
  127.      *
  128.      * @see nsIProtocolHandler::allowPort
  129.      */
  130.     boolean allowPort(in long aPort, in string aScheme);
  131.  
  132.     /**
  133.      * Utility to extract the scheme from a URL string, consistently and
  134.      * according to spec (see RFC 2396).
  135.      *
  136.      * NOTE: Most URL parsing is done via nsIURI, and in fact the scheme
  137.      * can also be extracted from a URL string via nsIURI.  This method
  138.      * is provided purely as an optimization.
  139.      *
  140.      * @param aSpec the URL string to parse
  141.      * @return URL scheme
  142.      *
  143.      * @throws NS_ERROR_MALFORMED_URI if URL string is not of the right form.
  144.      */
  145.     ACString extractScheme(in AUTF8String urlString);
  146. };
  147.